import { request } from './index'

export const addCarts = (id) => {
    return request({
        url: '/api/carts',
        method: 'post',
        data: {
            goods_id: id,
        }
    })
}

export const getCartsList = () => {
    return request({
        url: '/api/carts?include=goods',
    })
}

export const updateCarts = (id, data) => {
    return request({
        url: `/api/carts/${id}`,
        method: 'put',
        data
    })
}

export const removeCarts = (id) => {
    return request({
        url: `/api/carts/${id}`,
        method: 'delete',
    })
}

export const checkedCarts = cart_ids => {
    return request({
        url: `/api/carts/checked`,
        method: 'patch',
        data: {
            cart_ids
        }
    })
}